import request from "@/utils/request";

// 接口返回结构固定
// data 的类型, 传进来
type Result<T = undefined> = {
    code: string,
    message: string,
    data: T
}

//  获取推荐产品列表的数据
export function listShow(count: Number, limitNum: Number) {
    return request.get<any, Result>('/pro/recommendlist', {
        params: {
            count,
            limitNum
        }
    })
}


//  商品列表数据
export function getProductList(count: number, limitNum = 10) {
    return request.get<
        any,
        Result<Product[]>
    >('/pro/list', {
        params: {
            count,
            limitNum
        }
    })
}

//商品详细

export function getDetail(proid: string) {
    return request.get<any, Result>(`/pro/detail/${proid}`, {

    })
}


//  产品的分类列表
export function categorylist() {
    return request.get<any, Result>('/pro/categorylist', {

    })
}

// 产品分类下品牌列表
export function categorybrandlist(category: string) {
    return request.get<any, Result>('/pro/categorybrandlist', {
        params: {
            category,
        }
    })
}

//热门搜索
export function hotword() {
    return request.get<any, Result>('/pro/hotword', {})
}

//搜索列表
export function search(count: number, limitNum = 10, keyword: string) {
    return request.get<any, Result>('/pro/search', {
        params: {
            count,
            keyword
        }
    })
}